running sum of 1d array leetcode 1480 solution